using UnityEngine;
using System.Collections;

public enum CamEffect
{
	SetTarget = 1,
	ChangePosition = 2,
	Shake = 4,
	Mask = 8,
	RadicalBlur = 16,
	DOF = 32	
}

[System.Serializable]
public class AddCameraEffect : CharacterAction 
{
	public CamEffect camEffectFlags = 0;

	//SetTarget
	public Transform target;

	//ChangePosition
	public float angle = 60; //Angle camera
	public float distance = -5; //Distance target
	public float height = 8f; // Height camera	

    //reset camera rotation
    public bool resetCameraAngle = true;
	//Shake
	public ShakeCameraData shakeData;

	//Mask

	//RadicalBlur


	//DOF


	void OnDestroy()
	{

	}

	public override void OnActionEnter(Character character)
	{
        if((camEffectFlags & CamEffect.SetTarget) != 0)
        {
            CameraFollow.instance.SetTarget(transform);
        }
        if((camEffectFlags & CamEffect.ChangePosition) != 0)
        {
            CameraFollow.instance.SetPosition(angle,distance,height);
            if(resetCameraAngle)
            {
                iTween.Stop(Camera.main.gameObject);
                Camera.main.transform.localEulerAngles = Vector3.zero;
            }
        }
        
        if((camEffectFlags & CamEffect.Shake) != 0)
        {
            CameraFollow.instance.Shake(shakeData);
        }
        
        if((camEffectFlags & CamEffect.Mask) != 0)
        {
                
        }
        
        if((camEffectFlags & CamEffect.RadicalBlur) != 0 )
        {
            //CameraFilterPack_Blur_Focus focus = CameraFollow.instance.cam.gameObject.GetComponent<CameraFilterPack_Blur_Focus>();
            //focus.enabled = true;
        }
        
        if((camEffectFlags & CamEffect.DOF) != 0 )
        {
                
        }
	}

	public override void OnActionExit(Character character)
	{
        if((camEffectFlags & CamEffect.RadicalBlur) != 0 )
        {
            //CameraFilterPack_Blur_Focus focus = CameraFollow.instance.cam.gameObject.GetComponent<CameraFilterPack_Blur_Focus>();
            //focus.enabled = false;
        }
	}

}
